package cn.edu.dgut.css.springboottest2.Config;

import cn.edu.dgut.css.springboottest2.CustomProperties;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

/**
 * @Author:GooGa
 * @Data:2020/10/26 23:12
 */
@EnableConfigurationProperties(CustomProperties.class)
public class AutoConfig {
    @Bean
    @ConditionalOnProperty(prefix = "googa.auto",name = "enable",havingValue = "true")
    CommandLineRunner createCustomCommandLineRunner(Environment env){
        return  new CustomCommandLineRunner(env);
    }
}
